package com.jackie.tongzhuang.Adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

import com.jackie.tongzhuang.Models.FenQi;
import com.jackie.tongzhuang.R;

import java.util.List;

public class FenQiListAdapter extends BaseAdapter {
    private Context context;
    private List<FenQi> items;



    public FenQiListAdapter(Context context, List<FenQi> items) {
        this.context = context;
        this.items = items;
    }

    @Override
    public int getCount() {
        return items.size();
    }

    @Override
    public Object getItem(int position) {
        return items.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int i, View view, ViewGroup parent) {
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.control_fenqilist, parent, false);
        }
        TextView t_rq = view.findViewById(R.id.fql_rq);
        TextView t_je = view.findViewById(R.id.fql_je);
        ImageView t_xq = view.findViewById(R.id.fql_xqimg);
        CheckBox t_check = view.findViewById(R.id.fql_check);
        TextView t_bz = view.findViewById(R.id.fql_bz);
        t_rq.setText(items.get(i).getChangHuanRiQi());
        t_je.setText("¥"+items.get(i).getFenQiJinE());
        t_bz.setText(items.get(i).getFenQiRiQi()+"  "+items.get(i).getJinHuoDan().getGongHuoShang().getMingCheng()+" 分期 第"+items.get(i).getQiShu()+" 期");


        return view;
    }
}
